<template>
	<view class="con">
		<video controls id="videoId" @play="play" @fullscreenchange="fullscreenchange" :autoplay="true" class="video-v"
			:src="$url+videoUrl">
		</video>
	</view>
	
</template>

<script>
	export default {
		data(){
			return{
				videoUrl:'',
			}
		},
		onLoad(options) {
			this.videoUrl=options.video;
		},
		onShow() {
			
		},
		onUnload() {
			console.log("关闭了"); 
		},
		methods:{
			// 播放时进入全屏
			play() {
				let videoContext = uni.createVideoContext('videoId', this)
				videoContext.requestFullScreen()
			},
			//退出全屏时暂停
			fullscreenchange(e) {
				if (!e.detail.fullScreen) {
					uni.createVideoContext('videoId', this).pause();
					uni.navigateTo({
						url: "/pages/userCate/userComm/vueErr"
					})
				}
				
			},
		}
	}
</script>

<style>
	page {
		background-color: #000000;
	}
	.con{
		display: flex;
		
		align-items: center;//垂直居中
	}
	.video-v{
		position: fixed;
		bottom: 0;
		width: 100%;
	}
</style>